package data_structure;

public class leetcode_0724 {
    public int pivotIndex(int[] nums) {
        int len=nums.length;
        int sum=0;
        for(int i=0;i<len;++i){
            sum+=nums[i];
        }
        int left=0;
        int lefti=len-1;
        for(int i=0;i<len;++i){
            if(left*2+nums[i]==sum) return i;
            left+=nums[i];
        }
        return -1;
    }
}
